package com.muyu.danmo.controller;


import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;

import com.muyu.danmo.domain.DanmoArtDepartment;
import com.muyu.danmo.service.IDanmoArtDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 院系类型Controller
 * 
 * @author yangle
 * @date 2024-12-20
 */
@RestController
@RequestMapping("/danmoArtDepartment")
public class DanmoArtDepartmentController extends BaseController
{
    @Autowired
    private IDanmoArtDepartmentService danmoArtDepartmentService;

    /**
     * 查询院系类型列表
     */
//    @RequiresPermissions("system:danmoArtDepartment:list")
    @GetMapping("/list")
    public Result list(DanmoArtDepartment danmoArtDepartment)
    {

        List<DanmoArtDepartment> list = danmoArtDepartmentService.selectDanmoArtDepartmentList(danmoArtDepartment);
        return Result.success(list);
    }

    /**
     * 导出院系类型列表
     */
//    @RequiresPermissions("system:danmoArtDepartment:export")
    @Log(title = "院系类型", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DanmoArtDepartment danmoArtDepartment)
    {
        List<DanmoArtDepartment> list = danmoArtDepartmentService.selectDanmoArtDepartmentList(danmoArtDepartment);
        ExcelUtil<DanmoArtDepartment> util = new ExcelUtil<DanmoArtDepartment>(DanmoArtDepartment.class);
        util.exportExcel(response, list, "院系类型数据");
    }

    /**
     * 获取院系类型详细信息
     */
//    @RequiresPermissions("system:danmoArtDepartment:query")
    @GetMapping(value = "/{id}")
    public Result getInfo(@PathVariable("id") Long id)
    {
        return success(danmoArtDepartmentService.selectDanmoArtDepartmentById(id));
    }

    /**
     * 新增院系类型
     */
//    @RequiresPermissions("system:danmoArtDepartment:add")
    @Log(title = "院系类型", businessType = BusinessType.INSERT)
    @PostMapping
    public Result add(@RequestBody DanmoArtDepartment danmoArtDepartment)
    {
        return danmoArtDepartmentService.insertDanmoArtDepartment(danmoArtDepartment);
    }

    /**
     * 修改院系类型
     */
//    @RequiresPermissions("system:danmoArtDepartment:edit")
    @Log(title = "院系类型", businessType = BusinessType.UPDATE)
    @PutMapping
    public Result edit(@RequestBody DanmoArtDepartment danmoArtDepartment)
    {
        return toAjax(danmoArtDepartmentService.updateDanmoArtDepartment(danmoArtDepartment));
    }

    /**
     * 删除院系类型
     */
//    @RequiresPermissions("system:danmoArtDepartment:remove")
    @Log(title = "院系类型", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public Result remove(@PathVariable Long[] ids)
    {
        return toAjax(danmoArtDepartmentService.deleteDanmoArtDepartmentByIds(ids));
    }
}
